Rewrite lint-no-raw-mdc as Ruby (was bash) - #21
Merged
Conversation
TODO files are working notes, not artifacts. They stay local for reference but should not be committed to the repo. Add TODO* to .gitignore and untrack TODO.final/ + TODO.impl/. Files remain on disk for local reference.
This is a Ruby library; the lint script should be Ruby too. The previous bash version required bash on PATH, and the prior PR had to special-case the Rakefile with 'bash bin/lint-no-raw-mdc' to make Windows CI work (cmd.exe cannot dispatch on shebangs). The Ruby port uses Open3.capture3 to invoke git grep and plain Ruby for filter logic. POSIX ERE source string declared as a constant since git grep -E does not accept Ruby regex syntax. Exit codes preserved: 0 clean, 1 violation, 2 git internal failure. Rakefile reverted to plain 'ruby bin/lint-no-raw-mdc' - Ruby is guaranteed on PATH because Rake runs on Ruby.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bin/lint-no-raw-mdcwas a bash script. For a Ruby library this is thewrong choice — it requires bash on PATH (works on Linux/macOS, and on
Windows only because Git for Windows ships bash), and the previous PR
had to special-case the Rakefile to invoke
bash bin/lint-no-raw-mdcexplicitly.
Change
Rewrote
bin/lint-no-raw-mdcas a Ruby script:#!/usr/bin/env rubyOpen3.capture3to invokegit grep-Edoesn't accept Ruby regex syntax like
\dor(?:...)internal failure
Rakefile reverted to
ruby "bin/lint-no-raw-mdc"— the previousbash bin/lint-no-raw-mdcworkaround is no longer needed. Ruby isguaranteed on PATH because Rake itself runs on Ruby.
Verified locally
bundle exec rake lint:registry— passes on a clean tree"MDC_P999"in a tracked file underlib/opencdd/entity/—the script reports the violation with exit 1, matching the previous
bash behavior
Test plan